1.1.1 安装 ant-design 报错
install
npm install antd --save
1
- 报错
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'H:\react\my-app\node_modules\.staging\antd-75a5a56a\dist\antd.js'
npm ERR! { [Error: EPERM: operation not permitted, unlink 'H:\react\my-app\node_modules\.staging\antd-75a5a56a\dist\antd.js']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, unlink 'H:\react\my-app\node_modules\.staging\antd-75a5a56a\dist\antd.js'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'H:\\react\\my-app\\node_modules\\.staging\\antd-75a5a56a\\dist\\antd.js' },
npm ERR! stack:
npm ERR! 'Error: EPERM: operation not permitted, unlink \'H:\\react\\my-app\\node_modules\\.staging\\antd-75a5a56a\\dist\\antd.js\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'H:\\react\\my-app\\node_modules\\.staging\\antd-75a5a56a\\dist\\antd.js',
npm ERR! parent: 'my-app' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\fairy\AppData\Roaming\npm-cache\_logs\2018-12-02T06_53_19_393Z-debug.log
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
npm ERR! Error: EPERM: operation not permitted, 使用管理员权限也解决不了
npm cache clean --force
npm install antd --save
发现
后来发现 从 create-react-app 都是 使用 yarn 安装的,就还是 yarn 安装 antd
我使用的是 npx 安装的
npx:
npx create-react-app my-app
yarn add antd
1
2
3
4
5
2
3
4
5
目录结构
my-app
├── README.md
├── node_modules
├── package.json
├── .gitignore
├── public
│ ├── favicon.ico
│ ├── index.html
│ └── manifest.json
└── src
├── App.css
├── App.js
├── App.test.js
├── index.css
├── index.js
├── logo.svg
└── serviceWorker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17